<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type"  content="text/html; charset=UTF-8">
<script type="text/javascript">
<!--
setTimeout("self.location.href='index.php'",2000);
//-->
</script>

<title>Datenbank schreiben</title>
</head>
<body>

<h1>Test für Spracheingabe - DB schreiben</h1>


<?php
$text = $_POST['text'];
$delete = $_POST['delete'];
$con = mysql_connect("localhost","root","blabla123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("kai", $con);

if ($delete != "")
{
	mysql_query("DELETE FROM   `kai`.`test`");
echo "Alle Einträge gelöscht";
	}
else if ($text != "")
{
	$text = strip_tags($text);
	echo "Schreibe folgenden Text in die Datenbank<br />" . $text;
$con = mysql_connect("localhost","root","blabla123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("kai", $con);

mysql_query("
INSERT INTO  `kai`.`test` (
`index` ,
`text`
)
VALUES (
NULL ,  '$text'
)");

mysql_close($con);
	}
else
{
	echo "Bitte Text eingeben!";
	}


?>


</body>
</html>